//
//  WorkHomeVC.m
//  XLDoctor
//
//  Created by longma on 2018/7/27.
//  Copyright © 2018年 XLH. All rights reserved.
//mj设置

#import "SettingController.h"
#import "AboutController.h"
#import "LanguageController.h"
#import "AccountSecurityVC.h"
#import "NotesGuideVC.h"
@interface SettingController ()
@property (weak, nonatomic) IBOutlet MJUICellImageTextView *aboutItemView;
@property (nonatomic, strong) NSDictionary *updateData;

@end

@implementation SettingController


- (void)viewDidLoad {
    self.backgroundColorType = BackgroundColorTypeGray;

    [super viewDidLoad];
   
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}

- (void)mj_setUI{
    [super mj_setUI];
    
    self.mj_titleLocalizable = @"Settings";
    
    MJWeakSelf
    [HealthHelper checkUpdateBlock:^(NSDictionary *data) {
        if(data){
            weakSelf.updateData = data;
            weakSelf.aboutItemView.dotLabel.hidden = false;
        }
    }];
}

#pragma mark - 方法
- (void)requestData{
    
}

- (IBAction)handleAccountSecurityButtonEvent:(UIButton *)sender {
    AccountSecurityVC *vc = [[AccountSecurityVC alloc]init];
    [self.navigationController pushViewController:vc animated:true];
}

- (IBAction)handleOperationGuideButtonEvent:(UIButton *)sender {
    NotesGuideVC *vc = [[NotesGuideVC alloc]init];
    [self.navigationController pushViewController:vc animated:true];
}

- (IBAction)handleLanguageButtonEvent:(UIButton *)sender {
    LanguageController *vc = [[LanguageController alloc]init];
    [self.navigationController pushViewController:vc animated:true];
}

- (IBAction)handleAboutAppButtonEvent:(UIButton *)sender {
    AboutController *vc = [[AboutController alloc]init];
    vc.updateData = self.updateData;
    [self.navigationController pushViewController:vc animated:true];
}

- (IBAction)handleLogoutButtonEvent:(UIButton *)sender {
    MJUIAlertViewConfigure *configure = [[MJUIAlertViewConfigure alloc]init];
    configure.confirmButtonColor = UIColor.mj_appColor;
    configure.confirmTitle = MJUILocalizedString(@"OK_qd");
    configure.cancelTitle = MJUILocalizedString(@"Cancel_qx");
    configure.messageAlignmentCenter = true;
    NSString *messageString = MJUILocalizedString(@"Do you want to log out now?");
    [MJUIAlertView alertViewWithTitle:MJUILocalizedString(@"Log Out") message:messageString configure:configure confirmBlock:^{
        
        
        [MJHttpNetWorking requestWithParams:@{} requestUri:user_logout requestType:RequestTypePost showLoading:true success:^(MJBaseModel *model) {
            
            if(model.code == 200){
                [UserManager.shared logout];
            }

        } failure:^(NSError *error) {
            
        }];

    } cancelBlock:^{

    }];
}

#pragma mark - 代理

#pragma mark - 懒加载

@end
